package com.example.myapplication

import android.app.Activity
import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProvider
import com.example.myapplication.databinding.Kotlin2Binding

/**
 * 类描述:
 * 创建人:   tangchao$
 * 创建时间: 2021/6/30$ 10:41 PM$
 * 联系方式: 419704299@qq.com
 * 修改人:   tangchao$
 * 修改时间: 2021/6/30$ 10:41 PM$
 * 修改备注:  [说明本次修改内容]
 */
class KotlinCoroutine2 : AppCompatActivity() {
    private val viewModel1: Kotlin2ViewModle by viewModels()

    // Get a reference to the ViewModel scoped to this Fragment
    private val viewModel by viewModels<Kotlin2ViewModle>()


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding = DataBindingUtil.setContentView<Kotlin2Binding>(this, R.layout.kotlin2)
        binding.viewModle = viewModel

        var homeViewModel = ViewModelProvider(this,ViewModelProvider.NewInstanceFactory()).get(Kotlin2ViewModle::class.java)

    }

}